package com.insurance.modules.claim.controller;

import com.insurance.common.common.ResponseData;
import com.insurance.common.utils.QueryList;
import com.insurance.modules.claim.entity.PolicyInfoEntity;
import com.insurance.modules.claim.service.PolicyInfoService;
import com.insurance.modules.claim.vo.request.PolicyListReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


/**
 * 保单(快照)表
 *
 * @author weiruifeng
 * @email
 * @date 2021-09-24 17:42:47
 */
@RestController
@RequestMapping("claim/policyinfo")
@Api(tags = "保单(快照)")
public class PolicyInfoController {
    @Autowired
    private PolicyInfoService policyInfoService;

    /**
     * 调用接口查询保单列表
     */
    @PostMapping("/list")
    @RequiresPermissions("claim:policyinfo:list")
    @ApiOperation(value = "调用接口查询保单列表", notes = "调用接口查询保单列表")
    public ResponseData<List<PolicyInfoEntity>> list(@RequestBody QueryList<PolicyListReq> param) {
        // TODO 调用接口查询保单信息，并转换对象
        List<PolicyInfoEntity> list = new ArrayList<>();
        return ResponseData.success(list);
    }

    /**
     * 根据id查询保单（快照）信息
     */
    @PostMapping("/info")
    @RequiresPermissions("claim:policyinfo:info")
    @ApiOperation(value = "根据id查询保单（快照）信息", notes = "根据id查询保单（快照）信息")
    public ResponseData<PolicyInfoEntity> info(@RequestParam(value = "id") String id) {
        return ResponseData.success(policyInfoService.getById(id));
    }

}
